"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
  // up 建表
  async up(queryInterface, Sequelize) {
    await queryInterface.createTable("Articles", {
      id: {
        allowNull: false,
        autoIncrement: true, //自增
        primaryKey: true,
        type: Sequelize.INTEGER,
      },
      title: {
        type: Sequelize.STRING,
      },
      content: {
        type: Sequelize.TEXT,
      },
      author: {
        type: Sequelize.STRING,
      },
      className: {
        type: Sequelize.STRING,
      },
      pageView: {
        type: Sequelize.INTEGER,
      },
      LikeCount: {
        type: Sequelize.INTEGER,
      },
      createdAt: {
        allowNull: true,
        type: Sequelize.BIGINT,
      },
      updatedAt: {
        allowNull: true,
        type: Sequelize.BIGINT,
      },
    });
    // await queryInterface.addColumn("Articles", "author", {
    //   type: Sequelize.STRING,
    //   allowNull: false,
    // });
  },
  // down 删除表
  async down(queryInterface, Sequelize) {
    await queryInterface.dropTable("Articles");
  },
};
